var webpack = require('webpack');

var publicPath = '/dist/'; //服务器路径
var path = __dirname + '/dist/';

var plugins = [];

module.exports = {
    entry: {
        app: ['./src/index'] //编译的入口文件
    },
    output: {
        publicPath, //编译好的文件，在服务器的路径
        path, //编译到当前目录
        filename: '[name].js' //编译后的文件名字
    },
    module: {
        loaders: [
            {
                test:/\.js?$/,
                exclude:/node_modules/,
                loader:'babel',
                query:{
                    presets:['react','es2015']
                }
            },
            {
                test: /\.css$/,
                exclude: /^node_modules$/,
                loader: 'style!css'
            },
            {
                test: /\.less?$/,
                exclude: /^node_modules$/,
                loader: 'style!css!less'
            },
            {
                test: /\.(png|jpg)$/,
                exclude: /^node_modules$/,
                loader: 'url?limit=20000&name=[name].[ext]' //注意后面那个limit的参数，当你图片大小小于这个限制的时候，会自动启用base64编码图片
            }
        ]
    },
    plugins,
    resolve: {
        extensions: ['', '.js', '.jsx'], //后缀名自动补全
    }
};